namespace WebRtcProject.Models.Messages
{
    public class SignalingEventMessage : BaseMessage
    {
        public string FromUserId { get; set; } = string.Empty;
        public string ToUserId { get; set; } = string.Empty;
        public string SignalType { get; set; } = string.Empty; // offer, answer, ice_candidate, offer_sent, answer_sent, call_ended
        public object? SignalData { get; set; }
        public string? RoomId { get; set; }
        public Dictionary<string, object> Metadata { get; set; } = new();

        public SignalingEventMessage()
        {
            MessageType = nameof(SignalingEventMessage);
        }

        public static SignalingEventMessage WebRtcOffer(string fromUserId, string toUserId, object offerData, string? roomId = null)
        {
            return new SignalingEventMessage
            {
                FromUserId = fromUserId,
                ToUserId = toUserId,
                SignalType = "offer",
                SignalData = offerData,
                RoomId = roomId
            };
        }

        public static SignalingEventMessage WebRtcAnswer(string fromUserId, string toUserId, object answerData, string? roomId = null)
        {
            return new SignalingEventMessage
            {
                FromUserId = fromUserId,
                ToUserId = toUserId,
                SignalType = "answer",
                SignalData = answerData,
                RoomId = roomId
            };
        }

        public static SignalingEventMessage IceCandidate(string fromUserId, string toUserId, object candidateData, string? roomId = null)
        {
            return new SignalingEventMessage
            {
                FromUserId = fromUserId,
                ToUserId = toUserId,
                SignalType = "ice_candidate",
                SignalData = candidateData,
                RoomId = roomId
            };
        }

        public static SignalingEventMessage OfferSent(string fromUserId, string toUserId, string? roomId = null)
        {
            return new SignalingEventMessage
            {
                FromUserId = fromUserId,
                ToUserId = toUserId,
                SignalType = "offer_sent",
                RoomId = roomId
            };
        }

        public static SignalingEventMessage AnswerSent(string fromUserId, string toUserId, string? roomId = null)
        {
            return new SignalingEventMessage
            {
                FromUserId = fromUserId,
                ToUserId = toUserId,
                SignalType = "answer_sent",
                RoomId = roomId
            };
        }

        public static SignalingEventMessage CallEnded(string fromUserId, string toUserId, string? roomId = null)
        {
            return new SignalingEventMessage
            {
                FromUserId = fromUserId,
                ToUserId = toUserId,
                SignalType = "call_ended",
                RoomId = roomId
            };
        }
    }
} 